<HTML>
<HEAD>
<TITLE>JavaScript Source Code 3000:  Password Protection:  Password Pro (In)</TITLE>
<META HTTP-EQUIV="JavaScript Source Code 3000" CONTENT = "no-cache">
<META NAME="date" CONTENT="2000-09-09">
<META NAME="channel" CONTENT="Web Developer">
<META NAME="author" CONTENT="Lefteris Haritou">
<META NAME="section" CONTENT="Password Protection">

<Script language="JavaScript">
<!-- Begin
var base= new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9","A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z","a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z")
var code=0;
var z=23;
var y=28;
var f= new Array();
var K= new Array();
for (x=0; x<10; x++){
f[x]=x<<9
f[x]+=23
}
for (x=10; x<36; x++){
y=y<<1
v= Math.sqrt(y)
v = parseInt(v,16)
v+=5
f[x]=v
y++
}
for (x=36; x<62; x++){
z=z<<1
v= Math.sqrt(z)
v = parseInt(v,16)
v+=74
f[x]=v
z++
}
function make(){
var pass = prompt("Enter the password you wish to set.","")
if (pass==null || pass==""){
exit()}
else{
var code=0;
var lpass=(pass.length)+1
if (lpass<5){
alert("Please enter a password with more than 3 characters");
make()}
else{
if (lpass>9){
alert("Sorry Password Invalid\n\nThere is a limit of 8 characters");
make()}
else{
for (l=1; l<lpass; l++){
K[l]=pass.charAt(l)
}
for (y=1; y<lpass; y++){
for(x=0; x<62; x++){
if (K[y]==base[x]){
code+=f[x]
code*=y
      }
   }
}
alert("Your access code is:   "+code+"\n\n\nWrite it down!\n\n\n\nYou need it below!");
alert("Be sure to also create the protected file, "+pass+".html");
         }
      }
   }
}
function exit(){
if (confirm("Do you really want to exit ?")){
history.back()}
else{
make()}
}
// End -->
</Script>

<SCRIPT LANGUAGE="JavaScript">

<!-- Original: Lefteris Haritou <lef@writeme.com> www.geocities.com/~lef -->

<!-- This script and many more are available online from -->


<!-- Begin
var base= new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9","A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z","a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z")
var pass=""
var z=23;
var y=28;
var f= new Array();
var K= new Array();
for (x=0; x<10; x++){
f[x]=x<<9
f[x]+=23
}
for (x=10; x<36; x++){
y=y<<1
v= Math.sqrt(y)
v = parseInt(v,16)
v+=5
f[x]=v
y++
}
for (x=36; x<62; x++){
z=z<<1
v= Math.sqrt(z)
v = parseInt(v,16)
v+=74
f[x]=v
z++
}
var iCounter = 3 //How many retries
function inc(){
iCounter--
if (iCounter > 0)
{
if (confirm("\nPassword is incorrect.\n\n\n\nRetry?"))
Check()
else
alert('Password incorrect.');
history.go(-1);

// You may use this element istead if you want.
// location.href='denied.html' //Cancel html file

}
else
alert('Your three tries are up.  Access Denied.');
history.go(-1);

// You may use this element istead if you want.
// location.href='denied.html' // 3 times incorrect html file

}
function Check(){
pass = prompt("Enter your password.","")
if(pass==null || pass==""){
history.go(-1)}
else{
var lpass=(pass.length)+1
for (l=1; l<lpass; l++){
K[l]=pass.charAt(l)
}
var code=0;
for (y=1; y<lpass; y++){
for(x=0; x<62; x++){
if (K[y]==base[x]){
code+=f[x]
code*=y
      }
   }
}

<!-- STEP TWO: Put access code here!  -->
if (code==174153441) 		// code==[your access code]

go()
else
inc()
   }
}
function go(){
location.href=pass+".html";
}
// End -->
</SCRIPT>
</HEAD>

<BODY BGCOLOR=#ffffff vlink=#0000ff>

<BR>
<center>
<table width="600" cellpadding="0" cellspacing="10">
<tr>
<td width="468" align="center">

	
</td>
<td width="120" align="center">

	
</td>
</tr>
</table>
<BR>
<BR>
<BASEFONT SIZE=3>
  <FONT SIZE=6>
<B><FONT SIZE="+2" FACE="Helvetica,Arial" ALIGN=RIGHT COLOR="#0000FF">
<b><A HREF="../index.htm" /" TARGET="_top">
Home</A> </b><img src="../img/arrow.gif" /img/arrow.gif" height=13 width=7 border=0 alt="}"> <b><A HREF="index.htm" /passwords/"><font color="#FF0000">Password Protection</font></A> </b>
<img src="../img/arrow.gif" /img/arrow.gif" height=13 width=7 border=0 alt="}"> <FONT COLOR="#006666">Password Pro (In)</FONT></b></FONT><BR>
</B><BR>
  </FONT>
<TABLE BORDER=0 WIDTH=500 CELLPADDING=3 CELLSPACING=0>
<tr><td><font FACE=" helvetica,arial,geneva">
<br>
<br>
<!-- Description --><!--content_start-->

Here is how to use the Password Pro on your own site.  Just put the first code into a new HTML document.  Load that HTML document and enter the password you wish to set.  Then, put the second code into a new HTML document.  Be sure to also change the code to your access code from the first script.  Then, create the password protected page with the format [access password].html
<hr>
</td></tr>
</table>
<!-- Demonstration -->
<center>
<A HREF="javascript:make()">Configure your access code.</A><BR>
<P>
</center>
<P>
<P>
</form>
<P>
<P>
<a name="source">
<table BORDER=0 WIDTH=486 CELLPADDING=3 CELLSPACING=0>
<tr><td BGCOLOR=yellow><font FACE="helvetica,arial,geneva"><b>JavaScript Source Code 3000:  Password Protection:  Password Pro</b>
<p>Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Apple-s).  The script is yours!!!<br><br></font></td></tr>
<tr><td BGCOLOR=yellow ALIGN=CENTER>
<form NAME="copy">

<DIV align="center">
<input type=button value="Highlight All" onClick="javascript:this.form.txt.focus();this.form.txt.select();">&nbsp;&nbsp;&nbsp;&nbsp;
<INPUT TYPE="text" NAME="total" VALUE="Script Size:  2.55 KB  " size="24">
</DIV>

<textarea NAME="txt" ROWS=20 COLS=75 WRAP=VIRTUAL>

&lt;!-- THREE STEPS TO INSTALL PASSWORD PRO:

   1.  Configure your access code with the script above.
   2.  Put the designated coding into the HEAD of document
   3.  Copy the final code into the BODY of document  --&gt;

&lt;!-- STEP ONE: Configure your access code with the script above!  --&gt;

&lt;!-- STEP TWO: Copy this code into the HEAD of your document  --&gt;

&lt;HEAD&gt;

&lt;SCRIPT LANGUAGE="JavaScript"&gt;

&lt;!-- Original:  Lefteris Haritou --&gt; 
&lt;!-- Web Site:  lef@writeme.com&gt; www.geocities.com/~lef --&gt;

&lt;! &gt;
&lt;! &gt;

&lt;!-- Begin
var base= new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9","A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z","a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z")
var pass=""
var z=23;
var y=28;
var f= new Array();
var K= new Array();
for (x=0; x&lt;10; x++){
f[x]=x&lt;&lt;9
f[x]+=23
}
for (x=10; x&lt;36; x++){
y=y&lt;&lt;1
v= Math.sqrt(y)
v = parseInt(v,16)
v+=5
f[x]=v
y++
}
for (x=36; x&lt;62; x++){
z=z&lt;&lt;1
v= Math.sqrt(z)
v = parseInt(v,16)
v+=74
f[x]=v
z++
}
var iCounter = 3 //How many retries
function inc(){
iCounter--
if (iCounter &gt; 0)
{
if (confirm("\nPassword is incorrect.\n\n\n\nRetry?"))
Check()
else
alert('Password incorrect.');
history.go(-1);

// You may use this element istead if you want.
// location.href='denied.html' //Cancel html file

}
else
alert('Your three tries are up.  Access Denied.');
history.go(-1);

// You may use this element istead if you want.
// location.href='denied.html' // 3 times incorrect html file

}
function Check(){
pass = prompt("Enter your password.","")
if(pass==null || pass==""){
history.go(-1)}
else{
var lpass=(pass.length)+1
for (l=1; l&lt;lpass; l++){
K[l]=pass.charAt(l)
}
var code=0;
for (y=1; y&lt;lpass; y++){
for(x=0; x&lt;62; x++){
if (K[y]==base[x]){
code+=f[x]
code*=y
      }
   }
}

&lt;!-- STEP TWO: Put access code here!  --&gt;
if (code==174153441) 		// code==[your access code]

go()
else
inc()
   }
}
function go(){
location.href=pass+".html";
}
// End --&gt;
&lt;/SCRIPT&gt;

&lt;!-- STEP THREE:  Put this coding into the BODY of your HTML document --&gt;

&lt;center&gt;
&lt;A HREF="javascript:Check()"&gt;Access the protected area.&lt;/A&gt;&lt;BR&gt;
&lt;P&gt;
&lt;/center&gt;

 

&lt;!-- Script Size:  2.55 KB  --&gt;
</textarea><br><font FACE="helvetica,arial,geneva"></font></td></tr>

</table>
</form>
</FONT>
</CENTER>


</center>
</body></html>